home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / vbasic / subvbx.exe / README.TXT < prev    next >
Text File  |  1993-05-14  |  2KB  |  44 lines

  1. Summary:
  2.  
  3. SUBVBX is a sample appliction that does Windows subclassing on a VBX 
  4. control using MFC 2.0.  The sample subclasses the grid control and 
  5. overrides the OnDlgCode() message handler and returns the 
  6. DLGS_WANTARROWS code.  Normally Windows uses the arrow keys to move 
  7. between controls in a dialog box and does not pass the arrow keys to the 
  8. control.  Subclassing the grid control and overriding the OnDlgCode() 
  9. message handler causes windows to pass the arrow keys to the grid 
  10. control so that it can use the keys to between cells in the control.
  11.  
  12. More Information:
  13.  
  14. Windows controls, such as an edit control or a listbox control, can be 
  15. subclassed in MFC using the CWnd::SubclassWindow() and 
  16. CWnd::SubclassDlgItem() functions.  These functions do not work for VBX 
  17. controls.  These functions rely on the fact that each window control has 
  18. its own windows procedure.  This way it is possible for an MFC object 
  19. to chain to controls original Windows procedure.  However, VB controls 
  20. under MFC 2.0 are managed by MFC objects.  So, VB controls use the same 
  21. windows procedure as all other MFC objects.  
  22.  
  23. In order to subclass a VB control in MFC 2.0 it is necessary to copy the 
  24. data from the original control object into the object that you want to 
  25. use to subclass the original control.  After the original object has 
  26. been copied, it can be detached and deleted, and the new control object 
  27. can be attached.  
  28.  
  29. This sample defines the CVBClone class that contains the function 
  30. SubclassVBControl().  This function does the copying, attaching and 
  31. detaching that is described above.  To use this class, derive a new 
  32. class from the CVBClone class and new message handling functions to the 
  33. message map.  This class can then be used to subclass a VB control in a 
  34. dialog box by calling the SubclassVBControl() function in the 
  35. OnInitDialog() or OnInitialUpdate() function of the dialog box or form 
  36. view that contains the control.  
  37.  
  38. This sample subclasses a grid control in a form view.  It defines the 
  39. CMyGrid class from CVBControl which it uses to subclass the control.  It 
  40. also calls SubclassVBControl in the OnInitialUpdate() of the form view 
  41. to subclass the control in the form view.
  42.  
  43.  
  44.